package com.jkdz.spyke.rs
{
	import com.jkgh.remedy.core.client.*;
	import flash.utils.ByteArray;
	import flash.net.Socket;

	public class SpykeFileSharerProxy extends SpykeWidgetProxy implements SpykeFileSharer
	{

		public function SpykeFileSharerProxy(remoteeID:int, connection:RemedyClientServerConnection)
		{
			super(remoteeID, connection);
		}

		public function registerListener(a:SpykeFileSharerListener):void
		{
			connection.performRun(remoteeID, function(connection:RemedyClientServerConnection):void {

				RemedyCodec.writeMethodID(connection.getSocket(), 33);
				RemedyMOClassManager.INSTANCE.writeWithGraph(a, connection, new Vector.<Object>());

			});
		}

		public function renameFolder(a:String):void
		{
			connection.performRun(remoteeID, function(connection:RemedyClientServerConnection):void {

				RemedyCodec.writeMethodID(connection.getSocket(), 34);
				RemedyStringClassManager.INSTANCE.writeWithGraph(a, connection, new Vector.<Object>());

			});
		}

		public function offerFile(a:String, b:int, c:SpykeFileChunkProvider, onReturn:Function/*String*/):void
		{
			connection.performCall(remoteeID, function(connection:RemedyClientServerConnection):void {

				RemedyCodec.writeMethodID(connection.getSocket(), 32);
				RemedyStringClassManager.INSTANCE.writeWithGraph(a, connection, new Vector.<Object>());
				RemedyIntegerClassManager.INSTANCE.writeWithGraph(b, connection, new Vector.<Object>());
				RemedyMOClassManager.INSTANCE.writeWithGraph(c, connection, new Vector.<Object>());

			}, new RemedyFunctionSpecification(onReturn, RemedyStringClassManager.INSTANCE));
		}

		public function unOfferFile(a:String):void
		{
			connection.performRun(remoteeID, function(connection:RemedyClientServerConnection):void {

				RemedyCodec.writeMethodID(connection.getSocket(), 35);
				RemedyStringClassManager.INSTANCE.writeWithGraph(a, connection, new Vector.<Object>());

			});
		}

		public function getName(onReturn:Function/*String*/):void
		{
			connection.performCall(remoteeID, function(connection:RemedyClientServerConnection):void {

				RemedyCodec.writeMethodID(connection.getSocket(), 31);

			}, new RemedyFunctionSpecification(onReturn, RemedyStringClassManager.INSTANCE));
		}

		public function getFiles(onReturn:Function/*Vector.<FileInfo>*/):void
		{
			connection.performCall(remoteeID, function(connection:RemedyClientServerConnection):void {

				RemedyCodec.writeMethodID(connection.getSocket(), 30);

			}, new RemedyFunctionSpecification(onReturn, RemedyArrayClassManager.forType(73)));
		}
	}
}
